const OpenAI = require('openai');

const baseURL = 'https://api.deepseek.com/v1';
const apiKey = 'sk-83c669a378b7404f90fe91806fb5dafc';

const openai = new OpenAI({
    baseURL,
    apiKey,
});

// 请求deepseek的api，请求成语或词语的解释
const getDeepseekExplanation = async (text) => {
    const completion = await openai.chat.completions.create({
      messages: [
        { role: "system", content: text },
      ],
      model: "deepseek-chat",
    });
    return completion;
}

module.exports = { getDeepseekExplanation };